﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace UtilZ.Tool.WatchdogPlugin
{
    /// <summary>
    /// 应用变更消息
    /// </summary>
    public class AppChangedMessage
    {
        #region 消息类型定义

        /// <summary>
        /// 无效消息
        /// </summary>
        public const int NONE = 0;

        /// <summary>
        /// 运行状态改变消息(运行/停止)
        /// </summary>
        public const int RUN_STATUS_CHANGED = 1;

        /// <summary>
        /// 监视状态改变消息(监视/未监视)
        /// </summary>
        public const int MONITOR_STATUS_CHANGED = 2;

        /// <summary>
        /// 应用修改消息(应用编辑)
        /// </summary>
        public const int APP_MODIFY = 3;

        /// <summary>
        /// 增加应用消息(添加了应用列表)
        /// </summary>
        public const int APP_ADD = 4;

        /// <summary>
        /// 删除应用消息(删除了应用列表)
        /// </summary>
        public const int APP_REMOVE = 5;

        #endregion


        /// <summary>
        /// 消息类型
        /// </summary>
        public int MessageType { get; set; } = NONE;

        /// <summary>
        /// 添加/移除应用名称列表
        /// </summary>
        public List<string> AppNames { get; set; } = null;

        /// <summary>
        /// 应用运行状态(运行状态改变有效)
        /// </summary>
        public bool RunStatus { get; set; } = false;

        /// <summary>
        /// 应用监视状态(监视状态改变有效)
        /// </summary>
        public bool IsMonitor { get; set; } = false;

        /// <summary>
        /// 启动时间
        /// </summary>
        public DateTime? StartTime { get; set; }



        /// <summary>
        /// 构造函数
        /// </summary>
        public AppChangedMessage(int meesageType)
        {
            this.MessageType = meesageType;
        }

        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="meesageType"></param>
        /// <param name="appName"></param>
        public AppChangedMessage(int meesageType, string appName)
        {
            this.MessageType = meesageType;
            this.AppNames = new List<string> { appName };
        }

    }


}
